﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using OLTS.DATA_SERVICE;
using OLTS.MODEL;

namespace ONTS.WEB.Service
{
    /// <summary>
    /// Summary description for GetLeaveService
    /// </summary>
    public class GetLeaveService : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            String val = "0:Select Leave";
            var _cmd = new LEAVE_Service();

            foreach (var d in _cmd.GetAll())
            {
                if (val != "")
                    val += ";";

                val += d.ID + ":" + d.NAME;
            }
            context.Response.ContentType = "text/html";
            context.Response.Write(new JavaScriptSerializer().Serialize(val));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}